<div class="main-left">
	<iframe id="index-frame" src="map.html" frameborder="0" width="100%" height="94%" scrolling="yes"></iframe>
	<div class="page-tool">
		<div class="prev left no"></div>
		<div class="next right"></div>
	</div>
	<div id="foot_frame" class="footer clearfix">
	<div class="foot-l left">
                Copyright © 2016-2017&nbsp;&nbsp;<a href="#">深圳市城市公共安全技术研究院</a>.&nbsp;&nbsp;All rights reserved.
            </div>
            <div class="foot-r right">
                Version 1.0.1
            </div>
	</div>
</div>
<div class="main-right">
	<div id="knowledge" class="title" style="cursor:pointer;">专家知识库</div>
	<ul class="news-list" id="knowledgeul">
		<!-- <li>
			<p class="order-number">01</p>
			<p class="news-title">雨量导致泥石流</p>
			<div class="news-tool clearfix right">
				<div class="read">
					<div class="myicon"></div>
				</div>
			</div>
			<div class="news-content">
				雨量导致泥石流</div>
		</li>
		<li>
			<p class="order-number">02</p>
			<p class="news-title">地表位移计算方式</p>
			<div class="news-tool clearfix right">
				<div class="read">
					<div class="myicon"></div>
				</div>
			</div>
			<div class="news-content">
				地表位移计算方式</div>
		</li>
		<li>
			<p class="order-number">03</p>
			<p class="news-title">预警预报与应急救援</p>
			<div class="news-tool clearfix right">
				<div class="read">
					<div class="myicon"></div>
				</div>
			</div>
			<div class="news-content">
				预警预报与应急救援</div>
		</li> -->
		<!-- <li>
			<p class="order-number">04</p>
			<p class="news-title">雨量蓝色告警值为20</p>
			<div class="news-tool clearfix right">
				<div class="read">
					<div class="myicon"></div>
				</div>
			</div>
			<div class="news-content">
				雨量蓝色告警值为20</div>
		</li> -->
	</ul>
	<div class="title">设备工况</div>
	<ul class="news-list" id="device">
		<!-- <li>
			<p class="order-number">
				<img src="../../images/geological/icons/sbzc.png" style="height: 0.3rem;width: 0.3rem"/>
			</p>
			<p class="news-title">KXS1-1设备正常</p>
			<div class="news-tool clearfix right">
				<div class="read">
					<div class="myicon"></div>
				</div>
			</div>
			<div class="news-content">
				KXS1-1设备正常</div>
		</li>
		<li>
			<p class="order-number">
				<img src="../../images/geological/icons/sbyc.png" style="height: 0.3rem;width: 0.3rem"/>
			</p>
			<div class="sbyc"></div>
			<p class="news-title">HSL5-1-1设备异常</p>
			<div class="news-tool clearfix right">
				<div class="read">
					<div class="myicon"></div>
				</div>
			</div>
			<div class="news-content">
				HSL5-1-1设备异常</div>
		</li>
		<li>
			<p class="order-number">
				<img src="../../images/geological/icons/sbyc.png" style="height: 0.3rem;width: 0.3rem"/>
			</p>
			<div class="sbyc"></div>
			<p class="news-title">BD2-1设备异常</p>
			<div class="news-tool clearfix right">
				<div class="read">
					<div class="myicon"></div>
				</div>
			</div>
			<div class="news-content">
				BD2-1设备异常</div>
		</li> -->
	</ul>
	<div id="warning_info" class="title" style="cursor:pointer;">预警信息</div>
	<ul class="news-list" id="warning">
		<!-- <li>
			<p class="order-number">01</p>
			<p class="news-title">JY-1黄色预警</p>
			<div class="news-tool clearfix right">
				<div class="read">
					<div class="myicon"></div>
				</div>
			</div>
			<div class="news-content">
				JY-1黄色预警</div>
		</li>
		<li>
			<p class="order-number">02</p>
			<p class="news-title">GCX1-1-2蓝色预警</p>
			<div class="news-tool clearfix right">
				<div class="read">
					<div class="myicon"></div>
				</div>
			</div>
			<div class="news-content">
				GCX1-1-2蓝色预警</div>
		</li>
		<li>
			<p class="order-number">02</p>
			<p class="news-title">BD1-3蓝色预警</p>
			<div class="news-tool clearfix right">
				<div class="read">
					<div class="myicon"></div>
				</div>
			</div>
			<div class="news-content">
				BD1-3蓝色预警</div>
		</li> -->
	</ul>
</div>

<script type="text/javascript" src="../../js/geological/public.js"></script>
<script type="text/javascript">
//知识库链接
function showKnowledge(id) {
	window.open("../../tbl_knowledge_base/show/" + id);
}
    $(document).ready(function(){
    	
    	initDeviceInfo();
    	initWarningInfo();
    	initKnowledgeInfo();
    	
        var locationArr=[
            "map.html",
            "http://120.237.100.170:8089/HtmlPage.html",
            //"http://wish3d.com/project.jsp?guid=31fa4016-9099-4115-84d9-bdba0fe34cce&head=0&e=0&c=0&t=1&l=0",
            "vedio.html"
            //"../../images/geological/4.jpg"
        ];
        var arrIndex=0;
        var indexframe=$("#index-frame");
        $(".prev").on("click",function(){
            if(arrIndex>0){
                arrIndex--;
                indexframe.attr("src",locationArr[arrIndex]);
            }
            if(arrIndex==0){
                $(this).addClass("no");
            }
            $(".next").removeClass("no");
        });
        $(".next").on("click",function(){
            if(arrIndex<locationArr.length-1){
                arrIndex++;
                indexframe.attr("src",locationArr[arrIndex]);
            }
            if(arrIndex==locationArr.length-1){
                $(".next").removeClass("no");
                $(this).addClass("no");
            }
            $(".prev").removeClass("no");
        });
        $(".news-tool>div.read").on("click",function(e){
            e.stopPropagation();
            $(this).parents("li").toggleClass("current");
        });
        $(".news-list>li").on("click",function(){
            /* $(this).toggleClass("current"); */
            /* window.open("http://baidu.com"); */
        });
        $(".news-list").niceScroll({
            cursorcolor:"#999",
            cursoropacitymax:1,
            touchbehavior:false,
            cursorwidth:"6px",
            cursorborder:"0",
            cursorborderradius:"5px",
            autohidemode:false
        });
        
        //设备工况
        function initDeviceInfo() {
        	var param = {};
        	param.page = 1;
        	param.pagesize = 3;
        	param.orderColName ="update_time";
        	param.orderType = "DESC";
    		var json_data = JSON.stringify( param );
        	$.ajax({
      		  url: '../../tbl_device/list',
      		  type : 'post',
      		  async : false,
      		  /* data : {
      			  page : 0,
      			  pageSize : 3
      		  }, */
      		  data :　json_data,
      		  contentType: "application/json; charset=utf-8",
      		  dataType: "json",
      		  success: function(json) {
      			console.log(json);
      			showDeviceInfo(json.data);
      		  }
      		});
        }
        
        //显示设备工况
        function showDeviceInfo(deviceList){
        	var deviceInfoDiv = "";
        	for(var i = 0; i < 3; i ++) {
        		var deviceInfo = deviceList[i];
        		//var deviceInfo = {};
        		//deviceInfo.name = "test" + i;
        		var html = "";
        		if (deviceInfo.status == 0) {
        			html = '<li><p class="order-number"><img src="../../images/geological/icons/sbyc.png" style="height: 0.3rem;width: 0.3rem"/>'
            			+ '</p><p class="news-title">' + deviceInfo.name + '设备异常</p><div class="news-tool clearfix right"><div class="read"><div class="myicon"></div>'
    					+ '</div></div><div class="news-content">' + deviceInfo.name + '设备异常</div></li>';
        		} else {
        			html = '<li><p class="order-number"><img src="../../images/geological/icons/sbzc.png" style="height: 0.3rem;width: 0.3rem"/>'
        			+ '</p><p class="news-title">' + deviceInfo.name + '设备正常</p><div class="news-tool clearfix right"><div class="read"><div class="myicon"></div>'
					+ '</div></div><div class="news-content">' + deviceInfo.name + '设备正常</div></li>';
        		}
				deviceInfoDiv += html;
        	}
        	$("#device").append(deviceInfoDiv);
        }
        
      //预警信息
        function initWarningInfo() {
        	var param = {};
        	param.page = 1;
        	param.pagesize = 3;
        	param.is_warning = 0;
        	param.orderColName ="update_time";
        	param.orderType = "DESC";
    		var json_data = JSON.stringify( param );
        	$.ajax({
      		  url: '../../tbl_warning_info/list',
      		  type : 'post',
      		  async : false,
      		  /* data : {
      			  page : 0,
      			  pageSize : 3
      		  }, */
      		  data :　json_data,
      		  contentType: "application/json; charset=utf-8",
      		  dataType: "json",
      		  success: function(json) {
      			console.log(json);
      			if(json.data != null && json.data.length > 0){
      				showWarningInfo(json.data);
      			}
      		  }
      		});
        }
        
        //显示预警信息
        function showWarningInfo(warningInfoList){
        	var warningInfoDiv = "";
        	var size = warningInfoList.length;
        	if(warningInfoList.length > 3) {
        		size = 3;
        	}
        	for(var i = 0; i < size; i ++) {
        		var warningInfo = warningInfoList[i];
        		var html = '<li><p class="news-title">' + warningInfo.station_name + warningInfo.warn_level +'</p>'
        			+ '<div class="news-tool clearfix right">'
        			+ '<div class="read">'
        			+ '<div class="myicon"></div>'
        			+ '</div>'
        			+ '</div>'
        			+ '</li>';
        		warningInfoDiv += html;
        	}
        	$("#warning").append(warningInfoDiv);
        }
        
        //知识库
        function initKnowledgeInfo() {
        	var param = {};
        	param.page = 1;
        	param.pagesize = 3;
        	param.is_warning = 0;
        	param.orderColName ="update_time";
        	param.orderType = "DESC";
    		var json_data = JSON.stringify( param );
        	$.ajax({
      		  url: '../../tbl_knowledge_base/list',
      		  type : 'post',
      		  async : false,
      		  /* data : {
      			  page : 0,
      			  pageSize : 3
      		  }, */
      		  data :　json_data,
      		  contentType: "application/json; charset=utf-8",
      		  dataType: "json",
      		  success: function(json) {
      			console.log(json);
      			if(json.data != null && json.data.length > 0){
      				showKnowledgeInfo(json.data);
      			}
      		  }
      		});
        }
        
        //显示预警信息
        function showKnowledgeInfo(knowledgeInfoList){
        	var knowledgeInfoDiv = "";
        	var size = knowledgeInfoList.length;
        	if(knowledgeInfoList.length > 3) {
        		size = 3;
        	}
        	for(var i = 0; i < size; i ++) {
        		var knowledgeInfo = knowledgeInfoList[i];
        		var html = '<li onclick="showKnowledge(\''+knowledgeInfo.id+'\')"><p class="news-title">' + knowledgeInfo.title +'</p>'
        			+ '<div class="news-tool clearfix right">'
        			+ '<div class="read">'
        			+ '<div class="myicon"></div>'
        			+ '</div>'
        			+ '</div>'
        			+ '</li>';
        		knowledgeInfoDiv += html;
        	}
        	$("#knowledgeul").append(knowledgeInfoDiv);
        }
        
        
        function loadPage( _url ){
        	//iframe里获取global
        	//window.parent.global.search_station_type
        	$(window.parent.document).find("#middle_frame").load(_url);
        }
        
        $("#device>li").on("click",function(){
        	$(window.parent.document).find("#work_stat").trigger("click");
        });
        
    });

    $("#knowledge").click(function(){
    	$("#middle_frame").load("knowledge/knowledge_frame.html");
    	//$("#middle_frame").load("simulation/simulation_frame.html");
    //	$("#middle_frame").load("survey_data/survey_data_frame.html");
    	//$("#middle_frame").load("data_bak/data_bak_frame.html");
    	//global.showIndexModal("知识管理", "knowledge/knowledge_frame.html", "80%", "400px");    	
    });
    
    $("#warning>li").click(function(){
    	$("#middle_frame").load("station/warning_info_frame.html");
    	//global.showIndexModal("预警信息", "station/warning_info_frame.html", "80%", "400px");    	
    });
</script>